package com.ruoyi.oa.mapper;

import com.ruoyi.oa.domain.OaAdminAsset;
import com.ruoyi.oa.domain.bo.OaAdminEntryBo;
import com.ruoyi.oa.domain.vo.OaAdminAssetVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.oa.domain.vo.OaTotalAssetVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 资产管理Mapper接口
 *
 * @author ruoyi
 * @date 2023-08-28
 */
public interface OaAdminAssetMapper extends BaseMapperPlus<OaAdminAssetMapper, OaAdminAsset, OaAdminAssetVo> {

    @Select("select asset_code assetCode from oa_admin_asset where asset_type=#{assetType}")
    List<String>  getAllStandard(@Param("assetType") String assetType);

    @Select("select product_name productName from oa_admin_asset where asset_type=#{assetType}")
    List<String>  getAllProduct(@Param("assetType") String assetType);

    @Select("select product_name productName from oa_admin_asset where asset_type=#{assetType} and  asset_code=#{assetCode}")
    List<String> getAllProductNameByAssetCode(@Param("assetType") String assetType,@Param("assetCode") String assetCode);


    @Select("select asset_code assetCode from oa_admin_asset where asset_type=#{assetType} and  product_name=#{productName}")
    List<String> getAllAssetCodeByProductName(@Param("assetType") String assetType,@Param("productName") String productName);
    @Select("select * from oa_admin_asset where asset_type=#{assetType} and  asset_code=#{assetCode} and product_name=#{productName} limit 1")
    OaAdminAsset checkHasOneData(@Param("assetType") String assetType,@Param("assetCode") String assetCode,@Param("productName") String productName);

    List<OaTotalAssetVo> getAssetHistory(OaAdminEntryBo bo);
}
